#ifndef TEST_TESTPATH
#define TEST_TESTPATH

#ifdef ECUT_MAIN

#include "cppunit/extensions/HelperMacros.h"

#include "core/path/Path.h"

using namespace path;
class TestPath : public CPPUNIT_NS::TestFixture {
	Path* aPath;
public:
	void setUp()
	{
		aPath = new Path();
	}
	void testAddThreeVertex()
	{
		Vertex v1("v1"), v2("v2"), v3("v3");
		Vertex::Edge edge1("e1", &v1, &v2), edge2("e2",&v2,&v3), edge3("e3",&v3,&v1);

		Vertex* originVertices[] = {&v1, &v2, &v3};
		Vertex* destinyVertices[] = {&v2, &v3, &v1};
		Vertex::Edge* edges[] = {&edge1, &edge2, &edge3};
		aPath->append(&edge1, 1.1);
		aPath->append(&edge2, 2.2);
		aPath->append(&edge3, 3.3);
		CPPUNIT_ASSERT_DOUBLES_EQUAL(aPath->cost(), 6.6, 0.01);
		Iterator* pathIterator = aPath->iterator();
		int count = 0;
		while(pathIterator->hasNext()) {
			pathIterator->next();
			CPPUNIT_ASSERT(pathIterator->currentVertex()->equals(originVertices[count]));
			CPPUNIT_ASSERT(pathIterator->nextVertex()->equals(destinyVertices[count]));
			CPPUNIT_ASSERT(pathIterator->transversingEdge()->equals(edges[count]));
			count++;
		}
		delete pathIterator;
		CPPUNIT_ASSERT(count == 3);
	}
	void tearDown()
	{
		delete aPath;
	}

	CPPUNIT_TEST_SUITE(TestPath);
	CPPUNIT_TEST(testAddThreeVertex);
	CPPUNIT_TEST_SUITE_END();
};

#endif /* ECUT_MAIN */

#endif /* TESTPATH */
